import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    show: false,
    routerData: [],
    activeShow: '/index'
  },
  mutations: {
    addRouter: function (state, item) {
      state.routerData.forEach((item) => {
        item.show = false
      })
      state.routerData.push(item)
    },

    changeStyle: function (state, items) {
      state.routerData.forEach((item) => {
        item.show = false
      })

      let key = state.routerData.find((item) => {
        return item.name == items.name
      })
      key.show = true
    },

    changeActive: function (state, item) {
      state.activeShow = item
    }
  },
  actions: {
  },
  modules: {
  }
})
